package com.wyl.pmd.rule.performance;

public class AvoidUsingShortType {

	public static void main(String[] args) {
		// bad
		short doNotUseShort = 0;
		short shouldNotBeUsed = 1;
		doNotUseShort += shouldNotBeUsed;
		// good
		int num1 = 0;
		int num2 = 1;
		num2 += num1;
		
		
		
		byte a=1;
		byte b=3;
		//byte c1=a+b;
		byte c=(byte)(a+b);
		byte d=1+3;
		//为什么byte c=a+b;这个不对。byte d=1+3;这个却没有错误

		
		
		// byte --> short --> [ int --> long --> float --> double ]
		// 精度小于int的数值运算的时候都回被自动转换为int后进行计算
	}

}
